<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>计算力扣银行的钱</title>
</head>
<body>
  <script>
    function fn(n) {
      let res = Math.floor(n / 7), r = n % 7
      return res * (res + 7) * 7 / 2 + (r + 1) * r / 2 + res * r
    }
    console.log(fn(4))
  </script>
</body>
</html>